package com.cwj.mansysback.service.impl;

import com.cwj.mansysback.dao.api.RanksDao;
import com.cwj.mansysback.dao.impl.RanksDaoImpl;
import com.cwj.mansysback.entity.Rank;
import com.cwj.mansysback.entity.Teacher;
import com.cwj.mansysback.service.api.RankService;

import java.util.List;

public class RankServiceImpl implements RankService {

    RanksDao ranksDao =new RanksDaoImpl();

    @Override
    public List<Rank> selectALL() {
        return ranksDao.selectALL();
    }

    @Override
    public boolean updateRank(String rid, String rname, double rpiece) {
        boolean flag = ranksDao.updateRank(rid,rname,rpiece);
        Teacher.updateStatic(true);
        return flag;
    }

    @Override
    public boolean insertRank(String rid, String rname, double rpiece) {
        boolean flag = ranksDao.addRank(rid,rname,rpiece);
        Teacher.updateStatic(flag);
        return flag;
    }

    @Override
    public boolean deleteRank(String rid) {
        boolean flag = ranksDao.deleteRank(rid);
        Teacher.updateStatic(flag);
        return flag;
    }
}
